package b1.scenes.home.picpane
{
	import b1.conifg.*;
	import b1.controls.basic.*;
	import b1.net.*;
	import b1.players.*;
	import b1.utils.*;
	import flash.ui.Mouse;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.text.*;
	
	public class EquipHonour extends Sprite
	{
		private var tip:RoundRec;
		private var equipType:int;
		private var equipScore:int;

		public function EquipHonour(equipType:int, equipScore:int)
		{
			this.equipType = equipType;
			this.equipScore = equipScore;
			var color:int = Config.equipScoreColor[equipScore];
			var HonourIcon:Class = ResourceHelper.getInstance().getClassByName("Honor" + equipType + "Color" + color);
			var honourIcon:Sprite = new HonourIcon();
			honourIcon.width = 20;
			honourIcon.height = 20;
			addChild(honourIcon);
			honourIcon.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
			honourIcon.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
		}
		
		private function onMouseOver(event:MouseEvent):void
		{
			Mouse.cursor = "button";
			var color:int = Config.equipScoreColor[equipScore];
			tip = new RoundRec(160, 50, 0.8, Config.equipColor1[color]);
			tip.x = this.x + (this.width - tip.width) / 2 ;
			tip.y = this.y + this.height + 10;
			this.parent.addChild(tip);
			var rankText:TextField = new TextField();
			rankText.selectable = false;
        	rankText.autoSize = TextFieldAutoSize.LEFT;
			var texFormat:TextFormat = new TextFormat("微软雅黑", 14, Config.equipColor1[color], true);
			rankText.defaultTextFormat = texFormat;
			rankText.text = Config.equipName[equipType] + " 的 " + Config.equipColorName[color] + "套装" + "\n得分: " + equipScore;
			rankText.x = 12;
			rankText.y = 2;
			tip.addChild(rankText);
		}
		
		private function onMouseOut(event:MouseEvent):void
		{
			Mouse.cursor = "auto";
			if (tip != null && tip.parent != null)
				tip.parent.removeChild(tip);
		}

	}
}